import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
    routes: [
        {
            path: '/',
            redirect: '/conList'
        },
        {
            path: '/conList',
            component: resolve => require(['../components/hotel/common/home.vue'], resolve),
            children: [
                {
                    path: '/',
                    component: resolve => require(['../components/hotel/page/list.vue'], resolve)     //主酒店编辑
                },
                {
                    path: '/conList',
                    component: resolve => require(['../components/hotel/page/list.vue'], resolve)     //子酒店列表
                },
                {
                    path: '/conList/:id',
                    component: resolve => require(['../components/hotel/page/from.vue'], resolve)  //子酒店编辑列表
                },
                {
                    path: '/inn',
                    component: resolve => require(['../components/hotel/page/inn.vue'], resolve)  //
                },
                {
                    path: '/account',
                    component: resolve => require(['../components/hotel/page/account.vue'], resolve)  //
                },
                {
                    path: '/accountAdd',
                    component: resolve => require(['../components/hotel/page/accountAdd.vue'], resolve)  //
                },
                {
                    path: '/accountUpdate',
                    component: resolve => require(['../components/hotel/page/accountUpdate.vue'], resolve)  //
                },
                {
                    path: '/groupAdd',
                    component: resolve => require(['../components/hotel/page/groupAdd.vue'], resolve)  //集团酒店添加
                },
                {
                    path: '/config/:id',
                    component: resolve => require(['../components/hotel/page/config.vue'], resolve)
                },
                {
                    path: '/test',
                    component: resolve => require(['../components/hotel/page/test.vue'], resolve)     //测试
                }

            ]
        },
        {
            path: '/vote',
            component: resolve => require(['../components/vote/common/home.vue'], resolve),
            children: [
                {
                    path: '/',
                    component: resolve => require(['../components/vote/page/list.vue'], resolve)     //主酒店编辑
                },
                {
                    path: '/vote/message',
                    component: resolve => require(['../components/vote/page/compile.vue'], resolve)     //
                }

            ]
        },
        {
            path: '/login',
            component: resolve => require(['../components/hotel/page/login.vue'], resolve),
            meta: {
                requireAuth: true,  // 添加该字段，表示进入这个路由是不需要登录的
            },
        },
    ]
})
